package com.job.Yangmingyu.Zuoye0714;

import java.io.IOException;

/**
 * @author com.job.Yangmingyu
 * @version 1.0
 * @since 2022-07-14 19:59:26
 */
public class UseRuntime {
    public static void main(String[] args) throws IOException {
        Runtime runtime= Runtime.getRuntime();
        //gc  exit
        System.out.println(runtime.availableProcessors());
        System.out.println(runtime.maxMemory()/1024/1024+"MB");
        System.out.println(runtime.freeMemory()/1024/1024+"MB");
        System.out.println(runtime.totalMemory()/1024/1024+"MB");
        //exec 执行 字符串形式的命令 得到一个进程
        runtime.exec("mspaint");
        runtime.exec("calc");
        runtime.exec("mstsc");
        //logoff  注销   shutdown -s -t 100(100s后关机) shutdown -a取消计时
    }
}